﻿using System;
using System.Globalization;
using System.Runtime.Serialization;

using SBPweb.PlAzureNet.Shared.Library.Actors;

namespace SBPweb.PlAzureNet.Server.Data.Actors
{

    partial class League : ILeague
    {

        [DataMember]
        public string Name
        {
            get;
            set;
        }

        [DataMember]
        public string Description
        {
            get;
            set;
        }

        [DataMember(Name = "LeagueTypeAsEnum")]
        LeagueTypes ILeague.LeagueType
        {
            get
            {
                return (LeagueTypes)this.LeagueType;
            }
            set
            {
                this.LeagueType = (byte)value;
            }
        }

        //ILocation ILeague.Location
        //{
        //    get
        //    {
        //        return this.Location;
        //    }
        //    set
        //    {
        //        this.Location = value as Location;
        //    }
        //}

        [IgnoreDataMember]
        public CultureInfo Culture
        {
            get
            {
                return CultureInfo.GetCultureInfo(this.CultureCode.Trim().Replace("_", "-"));
            }
            set
            {
                this.CultureCode = value.Name.Replace("-", "_");
            }
        }

    }

}